fn main() {
    println!("-------------------------");
    test1_create();
    println!("-------------------------");
    test2_change();
    println!("-------------------------");
    test3_simplize();
    println!("-------------------------");
    test4_update();
    println!("-------------------------");
    test5_tuple();
    println!("-------------------------");
    test6_unit();
    println!("-------------------------");
}
fn test1_create() {
    let user1 = User {
        active: true,
        username: String::from("brook"),
        email: String::from("brook@gmail.com"),
        sign_in_count: 1,
    };
    println!("{user1:?}");
}
fn test2_change() {
    let mut user1 = User {
        active: true,
        username: String::from("brook"),
        email: String::from("brook@gmail.com"),
        sign_in_count: 1,
    };
    user1.email = String::from("brook@outlook.com");
    println!("{user1:?}");
}
fn test3_simplize() {
    let user1 = build_user(String::from("Jack@yahoo.com"), String::from("Jack"));
    println!("{user1:?}");
}
fn build_user(email: String, username: String) -> User {
    User {
        active: true,
        username,
        email,
        sign_in_count: 1,
    }
}
fn test4_update() {
    let user1 = build_user(String::from("Jack@yahoo.com"), String::from("Jack"));
    let user2 = User {
        email: String::from("Jack@amazon.com"),
        ..user1
    };
    //println!("{user1.email}");//error
    println!("{user2:?}");
}
fn test5_tuple() {
    let color = Color(1, 2, 3);
    println!("{color:?}");
}
fn test6_unit() {
    let subject = AlwaysEqual;
    println!("{subject:?}");
}
#[derive(Debug)]
struct AlwaysEqual;
#[derive(Debug)]
struct Color(i32, i32, i32);
#[derive(Debug)]
struct User {
    active: bool,
    username: String,
    email: String,
    sign_in_count: u64,
}
